<#include "/layout/layout.ftl">
<#import "/layout/macro.ftl" as macro>
<#import "/layout/select.ftl" as my/>
<#assign css>
<#--此ftl中用到的css-->
</#assign>
<#assign js>
<#--此ftl中用到的js-->
<script>
	$(".btn-submit").click(function () {
		// 校验表单合法
		var bootstrapValidator = $(".form-edit").data('bootstrapValidator');
		bootstrapValidator.validate();
		if(bootstrapValidator.isValid()){
			$.ajax({
				type: "POST",
				url: "/feedback/edit",
				data: $(".form-edit").serialize(),
				dataType: "JSON",
				success: function(res){
					layer.msg(res.message, {time: 2000
					}, function(){
						location.href="/feedback/index";
					});
				}
			});
		}else{
			return false;
		}
	});

	$('.form-edit').bootstrapValidator({
		message: '请输入有效值',
		feedbackIcons: {
			valid: 'glyphicon glyphicon-ok',
			invalid: 'glyphicon glyphicon-remove',
			validating: 'glyphicon glyphicon-refresh'
		}
	});

</script>
</#assign>
<@layout title="编辑" active="feedback">
<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>
		<#if isAdd>
            新增
        <#else>
            编辑
        </#if>
		<small>用户反馈详细信息</small>
	</h1>
	<ol class="breadcrumb">
		<li><a href="/"><i class="fa fa-home"></i> 管理后台</a></li>
		<li><a href="#"><i class="fa fa-list-ul"></i> 用户反馈管理</a></li>
		<li class="active"><i class="fa fa-edit"></i>
		    <#if isAdd>
                新增
            <#else>
                编辑
            </#if>
		</li>
	</ol>
</section>
<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<!-- Default box -->
			<div class="box  box-primary">
				<form class="form-horizontal form-edit" method="post" action="feedback/edit">
					<div class="box-body">
						<input type="hidden" id="id" name="id" value="${feedback.id!}">
						<input type="hidden" id="isAdd" name="isAdd" value="${isAdd?string('true','false')}">
                        <div class="form-group"><label class="col-sm-2 control-label">投诉流水号：</label><div class="col-sm-10">${feedback.seqNo!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">问题类型：</label><div class="col-sm-10">${convert('FEEDBACK_TYPE',feedback.subType)!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">联系人：</label><div class="col-sm-10">${feedback.contact!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">联系方式：</label><div class="col-sm-10">${feedback.contactWay!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">内容：</label><div class="col-sm-10">${feedback.content!}</div></div>

                        <div class="form-group"><label class="col-sm-2 control-label">反馈时间：</label><div class="col-sm-10">${(feedback.createAt?string('yyyy-MM-dd HH:mm:ss'))!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">用户手机号：</label><div class="col-sm-10">${feedback.username!}</div></div>
                        <div class="form-group"><label class="col-sm-2 control-label">反馈状态：</label><div class="col-sm-10">
							<#if feedback.state== 0 >
								<span class="label label-success">未回复</span>
							<#else >
								<span class="label label-default">已回复</span>
							</#if>
                        </div></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">回复：</label>
                            <div class="col-sm-10">
                                <textarea required placeholder="请输入回复内容" id="result" name="result" class="form-control"
										  type="text" value="${feedback.result!}" rows="4" ></textarea>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-sm-2 control-label">相关图片：</label>
                            <div class="col-sm-10">
								<#list imgs as img>
									<img src="${img}" style="width: 400px;height: 400px">
								</#list>
							</div>
						</div>





					<div class="box-footer">
						<button type="button" class="btn btn-default btn-back">返回</button>
						<button type="button" class="btn btn-info pull-right btn-submit">提交</button>
					</div>

				</form>
			</div>
			<!-- /.box -->
		</div>
	</div>
</section>
<!-- /.content -->
</@layout>
